#ifndef ALLOCSET_H
#define ALLOCSET_H

#include "IAlloc.h"

class AllocSet : public IAllocSet
{
	public:
		void *AllocSetAlloc(MemoryContext context, Size size);
		void AllocSetFree(MemoryContext context, void *pointer);
		void *AllocSetRealloc(MemoryContext context, void *pointer, Size size);
		void AllocSetInit(MemoryContext context);
		void AllocSetReset(MemoryContext context);
		void AllocSetDelete(MemoryContext context);
		Size AllocSetGetChunkSpace(MemoryContext context, void *pointer);
		bool AllocSetIsEmpty(MemoryContext context);
		void AllocSetStats(MemoryContext context, int level);

#ifdef MEMORY_CONTEXT_CHECKING
		void AllocSetCheck(MemoryContext context);
#endif
	private:
		MCPool header;       /* Standard memory-context fields */
		/* Info about storage allocated in this context: */
		AllocBlock      blocks;                 /* head of list of blocks in this set */
		AllocChunk      freelist[ALLOCSET_NUM_FREELISTS];               /* free chunk lists */
		/* Allocation parameters for this context: */
		Size            initBlockSize;  /* initial block size */
		Size            maxBlockSize;   /* maximum block size */
		Size            nextBlockSize;  /* next block size to allocate */
		Size            allocChunkLimit;        /* effective chunk size limit */
		AllocBlock      keeper;                 /* if not NULL, keep this block over resets */
};

#endif

